//
// Copyright (C) Robert Bosch GmbH
// Date: March 2010
// Author: CR/RTC2-AP Kui Xu

#include "ve_ttsapi.h"
#include "ve_platform.h"
#include "vplatform.h"
#include "TTSEngine.h"

class VAutoWrapper : public TTSEngine
{
public:
	VAutoWrapper() : TTSEngine(TTS_ENGINE_VAUTO)
	{
		pDict = NULL;
		cTTSParam = 0;
	};
	virtual ~VAutoWrapper() { unInitialize(); };
	virtual bool initialize(void);
	virtual bool speak(int sessionID, const char * promptString, const char * logFilePath);
	virtual bool stop();

	void unInitialize();
	bool loadUserDict(const char * fName);
	bool unLoadUserDict();
	bool checkPlaybackStopped();
	int getStatus();

	VE_INSTALL hInstall;
	VE_HSPEECH hSpeech;
	VE_HINSTANCE hTTSInst;
	VE_PARAM ttsParam[16];
	NUAN_U16 cTTSParam;
	VE_OUTDEVINFO hOutDevInfo;
	VE_HRESOURCE hDcit;
	VPLATFORM_RESOURCES vResources;
	char dataInstallPath[1][256];
	char sVoice[256];
	PLATFORM_TCHAR * gDataInstallPaths[1];

	void * pDict;
};

static NUAN_ERROR cbOutNotifyToBuffer(
  VE_HINSTANCE              hTTSInst,
  VE_OUTDEV_HINSTANCE       hOutDevInst,
  VE_CALLBACKMSG          * pcbMessage,
  VE_USERDATA               userData);

static int idStatus; //0 - idle, 1 - begin process, 2 - speaking, 3 - end process
static NUAN_S16 * pPcmData = NULL;

